package com.bw.module_merchant


import com.bw.module_home.api.MerchantApiServer
import com.example.lib_net.HttpManger
import com.example.lib_net.RetrofitManager
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import retrofit2.Retrofit
import javax.inject.Qualifier
import javax.inject.Singleton
@Qualifier
@Retention(AnnotationRetention.BINARY)
annotation class Merchant{

}
@Module
@InstallIn(SingletonComponent::class) // 单例作
object NetworkModule {
    @Merchant
    @Provides
    @Singleton
    fun provideRetrofit(): Retrofit {
        return HttpManger.getRetrofit()
    }

    // 2. 关键：提供 HomeApiServer 实例
    @Provides
    @Singleton
    fun provideHomeApiServer(@Merchant retrofit: Retrofit): MerchantApiServer {
        // 通过 Retrofit 创建 HomeApiServer 接口的实现类
        return retrofit.create(MerchantApiServer::class.java)
    }
}